/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pa165.languageschoolpersistence.DAO;

import com.pa165.languageschoolpersistence.Exceptions.IllegalArgumentPersistenceException;
import com.pa165.languageschoolpersistence.Exceptions.ServiceFailureException;
import com.pa165.languageschoolpersistence.entities.Lector;
import com.pa165.languageschoolpersistence.entities.Lecture;
import java.util.List;

/**
 *
 * @author Aleksei Penzentcev
 */
public interface LectorDAO {

    /**
     * Method for adding Lectors. For conventions of a valid lector see Lector
     * entity. If a lector is not in the database, it returns the lector added.
     * If a lector is already in the database, it returns a null value.
     *
     * @param lector lector to be added.
     * @return Null if already in database, Lector added instead
     * @throws IllegalArgumentPersistenceException if lector is invalid
     * @throws ServiceFailureException if a problem during adding occurs.
     */
    public Lector add(Lector lector) throws ServiceFailureException;

    /**
     * Method for removing Lectors. For conventions of a valid lector see Lector
     * entity.
     *
     * @param lector lector to be removed.
     * @throws IllegalArgumentPersistenceException if lector is invalid
     * @throws ServiceFailureException is a problem during removal occurs or if
     * lector is already in the database.
     */
    public void remove(Lector lector) throws  IllegalArgumentPersistenceException;

    /**
     * Method for modifying Lectors. For conventions of a valid lector see
     * Lector entity.
     *
     * @param lector lector to be modified.
     * @return Modified Lector.
     * @throws IllegalArgumentPersistenceException if lector is invalid
     * @throws ServiceFailureException if a problem during adding occures or if
     * lector is not in the database.
     */
    public Lector modify(Lector lector) throws  IllegalArgumentPersistenceException;

    /**
     * Method for retrieving Lectors. For conventions of a valid lector see
     * Lector entity. Method gets lector by input ID.
     *
     * @param id ID to be searched for.
     * @return Null if not in database, Lector found instead
     * @throws IllegalArgumentPersistenceException if id is invalid(for details
     * see Lector entity)
     * @throws ServiceFailureException if a problem during search occures.
     */
    public Lector get(Long id) throws  IllegalArgumentPersistenceException;

    /**
     * Method for retrieving all Lectors. For conventions of a valid lector see
     * Lector entity. Method gets all lectors.
     *
     * @return Empty list if no lector , list of lectors found instead
     * @throws ServiceFailureException if a problem during search occures.
     */
    public List<Lector> getAll();

    /**
     * Method for enrolling Lector to Lecture. For conventions of a valid
     * Lecture see Lecture entity. Method that will add lecture to the list of
     * lectures of the lector. Calling enroll to enrolled lecture has no effect,
     * returns null. Lecture can be enrolled to any number of lectors.
     *
     * @param lecture Lecture to be enrolled.
     * @return lecture to which was lector enrolled, null if he was already
     * enrolled
     * @throws IllegalArgumentPersistenceException if lecture is invalid(for
     * details see Lecture entity)
     * @throws ServiceFailureException if a problem during process occures.
     */
    public Lecture enrollLecture(Lecture lecture, Lector lector) throws  IllegalArgumentPersistenceException;

    /**
     * Method for retrieving Lectors by name. For conventions of a valid lector
     * see Lector entity. Method gets lector by input name.
     *
     * @param name name to be searched for.
     * @return Null if no such lector in database, list of lectors found instead
     * @throws IllegalArgumentPersistenceException if name is invalid(for
     * details see Lector entity)
     * @throws ServiceFailureException if a problem during search occures.
     */
    public List<Lector> findByName(String name) throws  IllegalArgumentPersistenceException;
}
